<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>登录</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<%-- <script type="text/javascript" src="<%=basePath%>/jquery/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=basePath%>/jquery/jquery.easyui.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=basePath%>/jquery/easyui-lang-zh_CN.js" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/jquery/themes/default/easyui.css" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/jquery/themes/icon.css" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="<%=basePath%>/jquery/demo/demo.css" charset="utf-8"> --%>
    <script type="text/javascript" src="./jquery/jquery.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="./jquery/jquery.easyui.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="./jquery/easyui-lang-zh_CN.js" charset="utf-8"></script>
	<link rel="stylesheet" type="text/css" href="./jquery/themes/default/easyui.css" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="./jquery/themes/icon.css" charset="utf-8">
    <link rel="stylesheet" type="text/css" href="./jquery/demo/demo.css" charset="utf-8">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<script type="text/javascript">
	/* $(document).ready(function(){
		$("#loginBtn").click(function(){
			alert("点了");
			var Role = $("#Role").val();
			var userName = $("#userName").val();
			alert(userName);
			var passWord = $("#passWord").val();
			$.ajax({
				type:"POST",
				url:"/cup/login",
				data:{role:Role,userName:userName,passWord:passWord},
				dataType:"json",
				success:function(msg){
					//var d = eval("("+msg+")");
					alert();
					if(msg.result == "1"){
					$.messager.alert("提示","成功了");
					
					}else{
						alert("500");
					}
				},
				error:function(XMLResponse){
					alert(XMLResponse.responseText);
				}
			});
	}); */
	
	$(function(){
		var result = "${result}";
		if(result == "400"){
			$("#prompt").html("账户被锁定");
		}
		if(result == "500"){
			$("#prompt").html("账户或密码有误");
		}
		if(result == ""){
			$("#prompt").html("");
		}
	});
	
	
	function btn(){
		var Role = $("#Role").val();
		var userName = $("#userName").val();
		var passWord = $("#passWord").val();
		if(userName!=""&&passWord!=""){
			$.ajax({
				type:"POST",
				url:"/cup/login.action",
				data:{role:Role,userName:userName,passWord:passWord},
				dataType:"json",
				success:function(msg){
					if(msg.result == "200"){
						//alert("**欢迎使用系统**");
						window.location.href="WEB-INF/cup/admin.jsp";
						//window.location.href="index.html";
					}else if(msg.result == "400"){
						$("#prompt").html("账户被锁定");
					}else if(msg.result == "500"){
						$("#prompt").html("账户或密码有误");
					}else{
						
					}
				},
				error:function(XMLResponse){
					alert(XMLResponse.responseText);
				}
			});
		}else{
			if(userName=="" && passWord==""){
				$("#prompt").html("请输入账户密码");
			}else if(userName==""){
				$("#prompt").html("请输入账户");
			}else{
				$("#prompt").html("请输入密码");
			}
		}
		
	}
	
	function reset(){
		$("#userName").val("");
		$("#passWord").val("");
		$("#prompt").html("");
	}
	</script>
  </head>
  
  <body>
  <form action="login.action" method="POST">
  <div style="overflow-y:auto">
    <table
	style="background-image: url(./image/logPage.jpg); height: 100%; width: 100%">
	<tr align="center" valign="middle">
		<td>
		<TABLE style="height: 300; width: 492" cellSpacing=0 cellPadding=0
			border=0 align="center">
			<TBODY>
				<TR valign="middle">
					<TD colSpan=2
						style="background-image: url(./image/loginPage_01.jpg)"
						height=44><font face="黑体" size="4px" color="#196ed1"
						style="padding-left: 20px; vertical-align: middle">宿舍管理信息系统</font></TD>
				</TR>
				<TR>
					<TD width="203"><IMG height=200 alt=""
						src="./image/loginPage_02.jpg" width=202></TD>
					<TD
						style="background-image: url(./image/loginPage_03.jpg)"
						height=200 width=497>
					<form method="POST">
					<table>
						<!-- <tr>
							<td height="20" class="login_td" align="right">用户类型：</td>
							<td><select id="Role" name="role" style="width: 110px; height: 23px;font-size: 12px;align:right;valign:top; border-top-style: none; font-style: normal; border-right-style: none; font-family: Verdana, Arial, Sans-Serif">  
         							<option>管理员</option>   
         							<option>学生</option> 
        						</select> </td>
						</tr> -->
						<tr>
							<td width="66" height="20" class="login_td" align="right">账户：</td>
							<td width="115" height="20" class="login_td"><input
								type="text" id="userName" name="userName" value="" style="WIDTH: 110px" class="easyui-validatebox" required="true" missingMessage="该项不能为空"></td>
							<td></td>
						</tr>
						<tr>
							<td height="20" class="login_td" align="right">密码：</td>
							<td height="20" class="login_td"><input type="password"
								name="passWord" id="passWord" value="" style="WIDTH: 110px" class="easyui-validatebox" required="true" missingMessage="该项不能为空"></td>
							<td></td>
						</tr>
						<tr>
							<td height="20" colSpan=2  align="center"><span id="prompt" style="color:red;"></span></td>
						</tr>
						<!-- <tr>
							<td height="20"></td>
							<td></td>
							<td></td>
						</tr> -->
						
						<tr>
							<td height="20" colspan="2" align="center">
							<input id="loginBtn1" style="cursor:pointer;" type="submit" value="登陆" name="loginBtn1"/>
							<!-- <a href="script:void();" onclick="btn();">登录</a> -->
							&nbsp;
							<input type="button" style="cursor:pointer;" value="重置" onclick="reset();"/>
							<!-- <a href="script:void();" onclick="reset();">重置</a> -->
							&nbsp;</td>
							
						</tr>
						
						
					</table>
					</form>
					</TD>
				</TR>
				<!-- <tr>
					<td colSpan=2  align="center"><span id="prompt" style="color:red;"></span></td>
				</tr> -->
				<TR>
					<TD colSpan=2
						style="background-image: url(./image/loginPage_04.jpg)"
						 height=56 align="center" class="login_td"><font face="黑体" size="2px" color="#196ed1"
						style="vertical-align: middle">Copyright © Cup团队 . All Rights Reserved</font></TD>
				</TR>
			</TBODY>
		</TABLE>
		</td>
	</tr>
</table>
</div>
</form>
  </body>
</html>
